<%--
    Document   : test
    Created on : 7 Apr, 2010, 1:16:06 PM
    Author     : Praveen Kumar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">


<%--
    Document   : lists2choose
    Created on : Apr 5, 2010, 11:42:09 PM
    Author     : ANKUR
--%>
<%@ page import="java.sql.*"%>
<%@ page language="java" import="java.util.*"%>
<%
            String HID = request.getParameter("hostelId");
            String RID = request.getParameter("roomId");
            Connection connection = null;
            try {

                String driverName = "oracle.jdbc.driver.OracleDriver";
                Class.forName(driverName);

                // Create a connection to the database
                String serverName = "10.0.0.27";
                String portNumber = "1521";
                String sid = "XE";
                String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
                String uname = "aranya27";
                String pword = "doodledo";

                connection = DriverManager.getConnection(url, uname, pword);
                Statement st = null;
                String str;
                ResultSet rs;
                st = null;
                rs = null;
                st = connection.createStatement();

                str = "SELECT * FROM ROOM_ALLOTMENTS R1, STUDENT_BRANCH_ROLL R3, STUDENT_DETAILS R2 WHERE R1.SUID=R2.SUID AND R1.SUID=R3.SUID AND HOSTEL_ID=" + HID + " AND ROOM_ID=" + RID;
                rs = st.executeQuery(str);



%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="PPP-files/styles_tujc1.css" type="text/css" rel="stylesheet"/>
        <style type="text/css">A#vbUL_tujc1a{display:none}</style>

        <title>JSP Page</title>
    </head>
    <body bgcolor="#6A6A6A">
        <center>
            <table border="0" bgcolor="#E8E8E8"  cellpadding="0" cellspacing="0"  width="720">

                <tr  align="center">
                    <td width="720" colspan="" height="91" align="center"><img border="0" src="../images/back.jpg" width="720" height="159" ></td>
                </tr>
                <tr><td align="center" width="720" ><b><font color="navy"> <h2>STUDENTS BY ROOM NO.</h2></font></b> </td></tr>
                <tr><td  align="center" width="720" ><font color="navy">Hostel No. : <%= HID %> </font> </td></tr>
                <tr><td  align="center" width="720" ><font color="navy">Room No. : <%= RID %>  </font> </td></tr>
                <tr><td><table width="500" align="center" border="1">
                            <tr><th width="60%" >Student Name</th><th width="40%">Roll No.</th></tr>
                <%
                while(rs.next()){
                    %>

                <tr align="center">
                    <td width="60%" align="left">  &nbsp; &nbsp;  <%=rs.getString("sname")%></td>
                    <td width="40%"align="center"><%=rs.getString("rollno")%> </td>

                </tr>
                <%
                                }
                %>
                    </table>
                <tr><td >&nbsp;</td></tr>
                <tr><td >&nbsp;</td></tr>
                <tr><td  align="center" width="720"><input type="button" value="BACK TO PREVIOUS PAGE" onClick="history.back();" name="RES1ET" ></td></tr>
                <tr><td >&nbsp;</td></tr>

                <tr ><td bgcolor="#E8E8E8" colspan="2" width="425" height="73" align="center" valign="middle"  style="line-height:22px"><font size="1"><a href="../about.jsp"> ABOUT US</a> | <a href="../developer.jsp">DEVELOPERS</a> | <a href="../contact.jsp">CONTACT US</a><br>

                            © ONLINE ADMISSION SYSTEM, NATIONAL INSTITUTE OF TECHNOLOGY, DURGAPUR<BR> E-MAIL: webmaster@admin.nitdgp.ac.in</font></td>
                </tr>




            </table>





        </center>
    </body>
</html>

<%

                // st.executeUpdate(str);
                connection.close();

            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                System.out.println(" Could not find the database driver");
            } catch (SQLException e) {
                e.printStackTrace();
                System.out.println("Could not connect to the database");
            }
%>